package com.tledu.springboots01.dao.impl;

import com.tledu.springboots01.dao.UserDao;
import com.tledu.springboots01.model.User;
import com.tledu.springboots01.model.UserRowMapper;
import lombok.AllArgsConstructor;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author Lsj
 * @version 1.0
 * @date 2021/6/30 20:01
 */
@Repository
@AllArgsConstructor
public class UserDaoImpl implements UserDao {
    private final JdbcTemplate jdbcTemplate;
    /**
     * 查询全部用户
     *
     * @return 用户
     */
    @Override
    public List<User> list() {
        String sql = "select * from user";
        return jdbcTemplate.query(sql,new UserRowMapper());
    }
}
